#include <DAO.h>
string query_sql_password(string &account)
{
    MYSQL_RES *reslut = oal_ptr_null;
    MYSQL_ROW  sql_row;//MYSQL_ROW == char**
    MYSQL_FIELD *sql_cloumn;
    oal_uint8  column[3][20];
    string res_passwd;
    mysqlconnect* temp_connect = sqlpool->get_connect();
    if(temp_connect == oal_ptr_null)
    {
        return res_passwd;
    }
    string sql_s("SELECT passwd FROM  user WHERE name = ");
    sql_s.append(account);
    //oal_print("002222 ,connect addr [%p]\n",temp_connect);
    //oal_print("temp_connect host [%s]\n",temp_connect->mHost.c_str());
    oal_int32 ret = temp_connect->query(sql_s);
    //oal_print("111111\n");
    if(ret == 0)
    {
        reslut = temp_connect->store_result();
        if(reslut)
        {
            //oal_print("2222\n");
            oal_uint32 i,j;
            //cout<<"number of result: "<<(unsigned long)mysql_num_rows(result)<<endl;
            oal_uint32 rows = temp_connect->rows_num(reslut);
            oal_uint32 cloumns = temp_connect->fields_num(reslut);

            for(i=0; i<cloumns; i++)//获取列名
            {
                sql_cloumn = temp_connect->fetch_field(reslut);
                strcpy(column[i],sql_cloumn->name);
            }
            //oal_print("3333\n");
            for(i=0;i<cloumns;i++)
            {
                printf("%s\t",column[i]);
            }
            printf("\n");
            //oal_print("the rows is [%d]\n",rows);
            for(i = 0; i < rows; i++)
            {
                sql_row = temp_connect->fetch_row(reslut);
                for(j = 0;j < cloumns; j++)
                {
                    printf("%s\t",sql_row[j]);
                }
                
            }
            printf("\n the password [%s]",sql_row[2]);
            res_passwd.append(sql_row[2]);
            //printf("xxx\n");
            temp_connect->free_result(reslut);
            //res_passwd.append(sql_row[0]);
        }
    }
    return res_passwd;
}